group_num = 40

with open('src/Minco/traj_planner/config/car_group_1.11','r') as f:
    group_lines=[]
    for line in f.readlines():
        group_lines.append(line)
         
with open(f'group{group_num}.txt','w') as f:
  row_in_all = 0
  id_in_all = 0
  for group_id in range(group_num):
    for line in group_lines:
      if 'car_0' in line:
        f.write(line.replace('car_0', f'car_{str(group_id)}'))
      elif 'Car_0' in line:
        f.write(line.replace('Car_0', f'Car_{str(group_id)}\n'))
      else:
        f.write(line)